package br.com.linkideias.util;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class HibernateUtil {
	private static final SessionFactory sessionFactory;
	public static final String HIBERNATE_SESSION = "hibernate_session";
	
	static
	{
		sessionFactory = new AnnotationConfiguration().configure("br/com/linkideias/util/hibernate.cfg.xml").buildSessionFactory();
	}
/*	private SessionFactory getSessionFactoryCodigo()
	{
		Configuration configuration = new Configuration();
		configuration.setProperty("hibernate.dialect","org.hibernate.dialect.MySQLDialect");
		configuration.setProperty("hibernate.connection.driver_class", "com.mysql.jdbc.Driver");
		configuration.setProperty("hibernate.connection.url", "jdbc:mysql://localhost/siscom");
		configuration.setProperty("hibernate.connection.username", "siscom");
		configuration.setProperty("hibernate.connection.password", "siscom");
		configuration.setProperty("hibernate.c3p0.min_size", "1");
		configuration.setProperty("hibernate.c3p0.max_size", "5");
		configuration.setProperty("hibernate.c3p0.timeout", "300");
		configuration.setProperty("hibernate.c3p0.max_statements", "50");
		configuration.setProperty("hibernate.c3p0.idle_test_period", "300");
		configuration.setProperty("hibernate.current_session_context_class", "thread");
		configuration.setProperty("hibernate.show_sql", "true");
		configuration.setProperty("hibernate.format_sql", "true");
		configuration.addResource("br/com/siscom/model/bean/Fornecedor.hbm.xml");
		configuration.addResource("br/com/siscom/model/bean/Produto.hbm.xml");
		configuration.addResource("br/com/siscom/model/bean/Unidade.hbm.xml");
		return configuration.buildSessionFactory();
	}
*/
	public static SessionFactory getSessionFactory() {
		return sessionFactory;
	}
}
